home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / mipsABI / examples / sup / sup.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  8.6 KB  |  258 lines

  1. /*
  2.  * Copyright (c) 1992 Carnegie Mellon University
  3.  * All Rights Reserved.
  4.  * 
  5.  * Permission to use, copy, modify and distribute this software and its
  6.  * documentation is hereby granted, provided that both the copyright
  7.  * notice and this permission notice appear in all copies of the
  8.  * software, derivative works or modified versions, and any portions
  9.  * thereof, and that both notices appear in supporting documentation.
  10.  *
  11.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  12.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  13.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  14.  *
  15.  * Carnegie Mellon requests users of this software to return to
  16.  *
  17.  *  Software Distribution Coordinator  or  Software_Distribution@CS.CMU.EDU
  18.  *  School of Computer Science
  19.  *  Carnegie Mellon University
  20.  *  Pittsburgh PA 15213-3890
  21.  *
  22.  * any improvements or extensions that they make and grant Carnegie Mellon
  23.  * the rights to redistribute these changes.
  24.  */
  25. /* sup.h -- declarations for sup, supnamesrv, supfilesrv
  26.  *
  27.  * VERSION NUMBER for any program is given by:  a.b (c)
  28.  * where    a = PROTOVERSION    is the protocol version #
  29.  *        b = PGMVERSION        is program # within protocol
  30.  *        c = scmversion        is communication module version
  31.  *            (i.e. operating system for which scm is configured)
  32.  **********************************************************************
  33.  * HISTORY
  34.  * 13-Sep-92  Mary Thompson (mrt) at Carnegie-Mellon University
  35.  *    Changed name of DEFDIR from /usr/cs to /usr.
  36.  *
  37.  * 7-July-93  Nate Williams at Montana State University
  38.  *    Modified SUP to use gzip based compression when sending files
  39.  *    across the network to save BandWidth
  40.  *
  41.  * $Log: sup.h,v $
  42.  * Revision 1.2  1993/08/04  17:46:15  brezak
  43.  * Changes from nate for gzip'ed sup
  44.  *
  45.  * Revision 1.1.1.1  1993/05/21  14:52:18  cgd
  46.  * initial import of CMU's SUP to NetBSD
  47.  *
  48.  * Revision 1.10  92/08/11  12:06:42  mrt
  49.  *     Added definition for DEBUGFPORTNUM, the debugging port number.
  50.  *     Changed so that last and when file names could include
  51.  *     the relase name if any.
  52.  *     [92/07/23            mrt]
  53.  * 
  54.  * Revision 1.9  91/04/29  14:39:03  mja
  55.  *     Reduce MAXCHILDREN from 8 to 3.
  56.  * 
  57.  * Revision 1.8  89/08/23  14:55:30  gm0w
  58.  *     Moved coll.dir from supservers to supfiles.
  59.  *     [89/08/23            gm0w]
  60.  * 
  61.  * 18-Mar-88  Glenn Marcy (gm0w) at Carnegie-Mellon University
  62.  *    Added host=<hostfile> support to releases file.
  63.  *
  64.  * 27-Dec-87  Glenn Marcy (gm0w) at Carnegie-Mellon University
  65.  *    Added crosspatch support.  Removed nameserver support.
  66.  *
  67.  * 27-Jun-87  Glenn Marcy (gm0w) at Carnegie-Mellon University
  68.  *    Added TREELIST and other changes for "release" support.
  69.  *
  70.  * 25-May-87  Doug Philips (dwp) at Carnegie-Mellon University
  71.  *    Version 6 of the network protocol, better support to reflect errors
  72.  *    back to server logfile.
  73.  *
  74.  * 21-May-87  Chriss Stephens (chriss) at Carnegie Mellon University
  75.  *    Merged divergent CS and EE versions.
  76.  *
  77.  * 19-Sep-86  Mike Accetta (mja) at Carnegie-Mellon University
  78.  *    Added FILESUPTDEFAULT definition.
  79.  *
  80.  * 07-Jun-86  Glenn Marcy (gm0w) at Carnegie-Mellon University
  81.  *    Removed FILESRVBUSYWAIT.  Now uses exponential backoff.
  82.  *
  83.  * 30-May-86  Glenn Marcy (gm0w) at Carnegie-Mellon University
  84.  *    Added numeric port numbers to use when port names are not in the
  85.  *    host table.
  86.  *
  87.  * 04-Jan-86  Glenn Marcy (gm0w) at Carnegie-Mellon University
  88.  *    Update protocol version to 5 for name server protocol change to
  89.  *    allow multiple repositories per collection.  Added FILESRVBUSYWAIT
  90.  *    of 5 minutes.  Added FILELOCK file to indicate collections that
  91.  *    should be exclusively locked when upgraded.
  92.  *
  93.  * 22-Sep-85  Glenn Marcy (gm0w) at Carnegie-Mellon University
  94.  *    Merged 4.1 and 4.2 versions together.
  95.  *
  96.  * 04-Jun-85  Steven Shafer (sas) at Carnegie-Mellon University
  97.  *    Created for 4.2 BSD.
  98.  *
  99.  **********************************************************************
  100.  */
  101.  
  102. /* PGMVERSION is defined separately in each program */
  103. extern char scmversion[];        /* string version of scm */
  104. #define PROTOVERSION 8            /* version of network protocol */
  105. #define SCANVERSION  2            /* version of scan file format */
  106.  
  107. /* TCP servers for name server and file server */
  108. #define FILEPORT    "supfilesrv"
  109. #define FILEPORTNUM    871
  110. #define DEBUGFPORT    "supfiledbg"
  111. #define DEBUGFPORTNUM    1127
  112.  
  113. /* Data files used in scan.c */
  114. #define FILELIST    "sup/%s/%s"
  115. #define FILESCAN    "sup/%s/%s"
  116. #define FILEHOST    "sup/%s/%s"
  117. #define FILELISTDEF    "list"
  118. #define FILESCANDEF    "scan"
  119. #define FILEHOSTDEF    "host"
  120. #define DEFRELEASE    "default"
  121.  
  122. /* Data files used in sup.c */
  123. #define FILEBASEDEFAULT    "/usr/%s" /* also supfilesrv and supscan */
  124. #ifdef EE_XXX
  125. #define FILESUPDEFAULT    "%s/supfiles/coll.list"
  126. #define FILESUPTDEFAULT    "%s/supfiles/coll.what"
  127. #define FILEHOSTS    "%s/supfiles/coll.host"
  128. #else  EE_XXX
  129. #define FILESUPDEFAULT    "%s/lib/supfiles/coll.list"
  130. #define FILESUPTDEFAULT    "%s/lib/supfiles/coll.what"
  131. #define FILEHOSTS    "%s/lib/supfiles/coll.host"
  132. #endif EE_XXX
  133. #define FILEBKDIR    "%s/BACKUP"
  134. #define FILEBACKUP    "%s/BACKUP/%s"
  135. #define FILELAST    "sup/%s/last%s"
  136. #define FILELASTTEMP    "sup/%s/last.temp"
  137. #define FILELOCK    "sup/%s/lock"    /* also supfilesrv */
  138. #define FILEREFUSE    "sup/%s/refuse"
  139. #define FILEWHEN    "sup/%s/when%s"
  140.  
  141. /* Data files used in supfilesrv.c */
  142. #define FILEXPATCH    "%s/sup/xpatch.host"
  143. #ifdef EE_XXX
  144. #define FILEDIRS    "%s/supfiles/coll.dir" /* also supscan */
  145. #else  EE_XXX
  146. #define FILEDIRS    "%s/lib/supfiles/coll.dir" /* also supscan */
  147. #endif EE_XXX
  148. #define FILECRYPT    "sup/%s/crypt"
  149. #define FILELOGFILE    "sup/%s/logfile"
  150. #define FILEPREFIX    "sup/%s/prefix"    /* also supscan */
  151. #define FILERELEASES    "sup/%s/releases" /* also supscan */
  152.  
  153. /* String length */
  154. #define STRINGLENGTH    2000
  155.  
  156. /* Password transmission encryption key */
  157. #define PSWDCRYPT    "SuperMan"
  158. /* Test string for encryption */
  159. #define CRYPTTEST    "Hello there, Sailor Boy!"
  160.  
  161. /* Default directory for system sup information */
  162. #ifndef    DEFDIR
  163. #ifdef EE_XXX
  164. #define DEFDIR        "/etc"
  165. #else  EE_XXX
  166. #define DEFDIR        "/usr"
  167. #endif EE_XXX
  168. #endif    DEFDIR
  169.  
  170. /* Default login account for file server */
  171. #ifndef    DEFUSER
  172. #define DEFUSER        "anon"
  173. #endif    DEFUSER
  174.  
  175. /* subroutine return codes */
  176. #define SCMOK        (1)        /* routine performed correctly */
  177. #define SCMEOF        (0)        /* read EOF on network connection */
  178. #define SCMERR        (-1)        /* error occurred during routine */
  179.  
  180. /* data structure for describing a file being upgraded */
  181.  
  182. struct treestruct {
  183. /* fields for file information */
  184.     char *Tname;            /* path component name */
  185.     int Tflags;            /* flags of file */
  186.     int Tmode;            /* st_mode of file */
  187.     char *Tuser;            /* owner of file */
  188.     int Tuid;            /* owner id of file */
  189.     char *Tgroup;            /* group of file */
  190.     int Tgid;            /* group id of file */
  191.     int Tctime;            /* inode modification time */
  192.     int Tmtime;            /* data modification time */
  193.     struct treestruct *Tlink;    /* tree of link names */
  194.     struct treestruct *Texec;    /* tree of execute commands */
  195. /* fields for sibling AVL tree */
  196.     int Tbf;            /* balance factor */
  197.     struct treestruct *Tlo,*Thi;    /* ordered sibling tree */
  198. };
  199. typedef struct treestruct TREE;
  200.  
  201. /* data structure to represent a list of trees to upgrade */
  202.  
  203. struct tliststruct {
  204.     struct tliststruct *TLnext;    /* next entry in tree list */
  205. /* fields for tree information */
  206.     char *TLname;            /* release name for tree */
  207.     char *TLprefix;            /* prefix of tree */
  208.     char *TLlist;            /* name of list file */
  209.     char *TLscan;            /* name of scan file */
  210.     char *TLhost;            /* name of host file */
  211.     TREE *TLtree;            /* tree of files to upgrade */
  212. };
  213. typedef struct tliststruct TREELIST;
  214.  
  215. /* bitfield not defined in stat.h */
  216. #define S_IMODE          07777        /* part of st_mode that chmod sets */
  217.  
  218. /* flag bits for files */
  219. #define FNEW             01        /* ctime of file has changed */
  220. #define FBACKUP             02        /* backup of file is allowed */
  221. #define FNOACCT             04        /* don't set file information */
  222. #define FUPDATE            010        /* only set file information */
  223. #define FNEEDED        0100000        /* file needed for upgrade */
  224.  
  225. /* version 3 compatability */
  226. #define    FCOMPAT        0010000        /* Added to detect execute commands to send */
  227.  
  228. /* message types now obsolete */
  229. #define MSGFEXECQ    (115)
  230. #define MSGFEXECNAMES    (116)
  231.  
  232. /* flag bits for files in list of all files */
  233. #define ALLNEW              01
  234. #define ALLBACKUP          02
  235. #define ALLEND              04
  236. #define ALLDIR             010
  237. #define ALLNOACCT         020
  238. #define ALLSLINK        0100
  239.  
  240. /* flag bits for file mode word */
  241. #define MODELINK      010000
  242. #define MODEDIR          040000
  243. #define MODESYM         0100000
  244. #define MODENOACCT     0200000
  245. #define MODEUPDATE    01000000
  246.  
  247. /* blocking factor for filenames in list of all file names */
  248. #define BLOCKALL    32
  249.  
  250. /* end version 3 compatability */
  251.  
  252. #define MAXCHILDREN 3            /* maximum number of children allowed
  253.                        to sup at the same time */
  254.  
  255. /* scm and stree external declarations */
  256. char *remotehost();
  257. TREE *Tinsert(),*Tsearch(),*Tlookup();
  258.